<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="../include/laypublic.jsp" %>
<!DOCTYPE html>
<html>
<head>
</head>
<title>融资立项</title>
<style type="text/css">
    .layui-form-select dl {
        max-height: 150px;
    / / 原值为300，调节高度建议为50的倍数
    }

    .layui-form-label {
        width: 60px;
    }

    .flex {
        display: flex;
        justify-content: flex-start;
        align-items: center;
        margin-left: 50px !important;
        line-height: 1;
    }

    .flex span {
        line-height: 1;
        margin-right: 10px;
    }
</style>
</head>
<body>
<div class="layui-tab layui-tab-brief" lay-filter="rzlx-tab-all">
    <ul class="layui-tab-title">
        <li id="rzlxId" class="layui-this" lay-id="0">融资立项</li>
        <li id="rzcdId" lay-id="1">融资初调</li>
        <li id="rzjdId" lay-id="2">融资尽调</li>
        <li id="lxId" lay-id="3">立项</li>
    </ul>
    <div class="layui-tab-content" style="height: 100px;">
        <!-- 融资立项 -->
        <!-- ************************************************* 融资立项 *********************************************************** -->
        <div class="layui-tab-item layui-show">
            <!-- 查询区域  -->
            <div id="rzlx-query-form" class="layui-form layui-card-header layuiadmin-card-header-auto">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">项目名称</label>
                        <div class="layui-input-inline">
                            <input type="text" name="proName" placeholder="请输入项目名称" autocomplete="off"
                                   class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">区域公司</label>
                        <div class="layui-input-inline">
                            <select name="hrOrgId">
                                <option value="">全部</option>
                                <c:if test="${not empty orgInfoList }">
                                    <c:forEach items="${orgInfoList}" var="orgInfo">
                                        <option value="${orgInfo.id}">${orgInfo.compName }</option>
                                    </c:forEach>
                                </c:if>
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">日期</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" id="rzlx-laydate-date" name="dates" readonly
                                   placeholder="日期">
                        </div>
                    </div>
<%--                    <div class="layui-inline">--%>
<%--                        <label class="layui-form-label">状态</label>--%>
<%--                        <div class="layui-input-inline">--%>
<%--                            <select name="proStage">--%>
<%--                                <option value="">全部</option>--%>
<%--                                <option value="1">预立项</option>--%>
<%--                                <option value="2">立项</option>--%>
<%--                                <option value="3">营销策划</option>--%>
<%--                            </select>--%>
<%--                        </div>--%>
<%--                    </div>--%>
                    <div class="layui-inline">
                        <button class="layui-btn layuiadmin-btn-admin" lay-submit lay-filter="lay-rzlx-search">
                            <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>查询
                        </button>
                        <button class="layui-btn layuiadmin-btn-admin" lay-submit lay-filter="lay-rzlx-back-reset">
                            <i class="layui-icon layui-icon-fonts-clear  layuiadmin-button-btn"></i>重置
                        </button>
                    </div>
                </div>
            </div>
            <!-- 数据表单 -->
            <div class="layui-tab-item layui-show">
                <div class="layui-form-item "
                     style="width: 100% ;background: white;display: flex;margin: 0;padding: 6px 0">
                    <div class="layui-inline flex"><span
                            style="font-size: 35px;color: rgb(22,168,225);margin-top: -5px">○</span>表示：可执行
                    </div>
                    <div class="layui-inline flex"><span style="font-size: 25px;color: rgb(59,177,156)">✓</span>表示：评审通过
                    </div>
                    <div class="layui-inline flex"><span style="font-size: 25px;color: rgb(225,6,6)">ㄨ</span>表示：评审不通过
                    </div>
                    <div class="layui-inline flex"><span style="font-size: 25px;color: rgb(225,93,36)">ニ</span>表示：评审中
                    </div>
                    <div class="layui-inline flex"><span style="font-size: 25px;color: rgb(80,90,110)">／</span>表示：不需要评审
                    </div>
                </div>
                <table id="lay-rzlx-create-manage" lay-filter="lay-rzlx-create-manage" style="margin-top: 0"></table>
            </div>
        </div>

        <!-- 融资初调 -->
        <!-- ************************************************* rzcd *********************************************************** -->
        <div class="layui-tab-item">
            <!-- 查询区域  -->
            <div id="rzcd-query-form" class="layui-form layui-card-header layuiadmin-card-header-auto">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">项目编码</label>
                        <div class="layui-input-inline">
                            <input type="text" name="proCode" placeholder="请输入项目编码" autocomplete="off"
                                   class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">项目名称</label>
                        <div class="layui-input-inline">
                            <input type="text" name="proName" placeholder="请输入项目名称" autocomplete="off"
                                   class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">区域公司</label>
                        <div class="layui-input-inline">
                            <select name="hrOrgId">
                                <option value="">全部</option>
                                <c:if test="${not empty orgInfoList }">
                                    <c:forEach items="${orgInfoList}" var="orgInfo">
                                        <option value="${orgInfo.id}">${orgInfo.compName }</option>
                                    </c:forEach>
                                </c:if>
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">状态</label>
                        <div class="layui-input-inline">
                            <select name="processStatus">
                                <option value="">全部</option>
                                <option value="1">审批中</option>
                                <option value="9">审批完成</option>
                                <option value="10">审批终止</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">日期</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" id="rzcd-laydate-dates" name="dates" readonly
                                   placeholder="请选择创建时间">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">申请人</label>
                        <div class="layui-input-inline">
                            <select name="staffId">
                                <option value="">全部</option>
                                <c:if test="${not empty staffInfoList }">
                                    <c:forEach items="${staffInfoList}" var="staffInfo">
                                        <option value="${staffInfo.id}">${staffInfo.staffName }</option>
                                    </c:forEach>
                                </c:if>
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">授信余额</label>
                        <div class="layui-input-inline">
                            <select name="isCredit">
                                <option value="">满足</option>
                                <option value="1">不满足</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <button class="layui-btn layuiadmin-btn-admin" lay-submit lay-filter="lay-rzcd-search">
                            <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>查询
                        </button>
                        <button class="layui-btn layuiadmin-btn-admin" lay-submit lay-filter="lay-rzcd-back-reset">
                            <i class="layui-icon layui-icon-fonts-clear  layuiadmin-button-btn"></i>重置
                        </button>
                    </div>
                </div>
            </div>
            <!-- 数据表单 -->
            <div class="layui-tab-item layui-show">
                <table id="lay-rzcd-create-manage" lay-filter="lay-rzcd-create-manage"></table>
            </div>
        </div>

        <!-- 融资尽调 -->
        <!-- ************************************************* rzjd *********************************************************** -->
        <div class="layui-tab-item">
            <!-- 查询区域  -->
            <div id="rzjd-query-form" class="layui-form layui-card-header layuiadmin-card-header-auto">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">项目编码</label>
                        <div class="layui-input-inline">
                            <input type="text" name="proCode" placeholder="请输入项目编码" autocomplete="off"
                                   class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">项目名称</label>
                        <div class="layui-input-inline">
                            <input type="text" name="proName" placeholder="请输入项目名称" autocomplete="off"
                                   class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">区域公司</label>
                        <div class="layui-input-inline">
                            <select name="hrOrgId">
                                <option value="">全部</option>
                                <c:if test="${not empty orgInfoList }">
                                    <c:forEach items="${orgInfoList}" var="orgInfo">
                                        <option value="${orgInfo.id}">${orgInfo.compName }</option>
                                    </c:forEach>
                                </c:if>
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">状态</label>
                        <div class="layui-input-inline">
                            <select name="processStatus">
                                <option value="">全部</option>
                                <option value="1">审批中</option>
                                <option value="9">审批完成</option>
                                <option value="10">审批终止</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">日期</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" id="rzjd-laydate-dates" name="dates" readonly
                                   placeholder="请选择创建时间">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">申请人</label>
                        <div class="layui-input-inline">
                            <select name="staffId">
                                <option value="">全部</option>
                                <c:if test="${not empty staffInfoList }">
                                    <c:forEach items="${staffInfoList}" var="staffInfo">
                                        <option value="${staffInfo.id}">${staffInfo.staffName }</option>
                                    </c:forEach>
                                </c:if>
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">授信余额</label>
                        <div class="layui-input-inline">
                            <select name="isCredit">
                                <option value="">满足</option>
                                <option value="1">不满足</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <button class="layui-btn layuiadmin-btn-admin" lay-submit lay-filter="lay-rzjd-search">
                            <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>查询
                        </button>
                        <button class="layui-btn layuiadmin-btn-admin" lay-submit lay-filter="lay-rzjd-back-reset">
                            <i class="layui-icon layui-icon-fonts-clear  layuiadmin-button-btn"></i>重置
                        </button>
                    </div>
                </div>
            </div>
            <!-- 数据表单 -->
            <div class="layui-tab-item layui-show">
                <table id="lay-rzjd-create-manage" lay-filter="lay-rzjd-create-manage"></table>
            </div>
        </div>

        <!-- 立项 -->
        <!-- ************************************************* lx *********************************************************** -->
        <div class="layui-tab-item">
            <!-- 查询区域  -->
            <div id="lx-query-form" class="layui-form layui-card-header layuiadmin-card-header-auto">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">项目编码</label>
                        <div class="layui-input-inline">
                            <input type="text" name="proCode" placeholder="请输入项目编码" autocomplete="off"
                                   class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">项目名称</label>
                        <div class="layui-input-inline">
                            <input type="text" name="proName" placeholder="请输入项目名称" autocomplete="off"
                                   class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">区域公司</label>
                        <div class="layui-input-inline">
                            <select name="hrOrgId">
                                <option value="">全部</option>
                                <c:if test="${not empty orgInfoList }">
                                    <c:forEach items="${orgInfoList}" var="orgInfo">
                                        <option value="${orgInfo.id}">${orgInfo.compName }</option>
                                    </c:forEach>
                                </c:if>
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">状态</label>
                        <div class="layui-input-inline">
                            <select name="processStatus">
                                <option value="">全部</option>
                                <option value="1">审批中</option>
                                <option value="9">审批完成</option>
                                <option value="10">审批终止</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">日期</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" id="lx-laydate-dates" name="dates" readonly
                                   placeholder="请选择创建时间">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">申请人</label>
                        <div class="layui-input-inline">
                            <select name="staffId">
                                <option value="">全部</option>
                                <c:if test="${not empty staffInfoList }">
                                    <c:forEach items="${staffInfoList}" var="staffInfo">
                                        <option value="${staffInfo.id}">${staffInfo.staffName }</option>
                                    </c:forEach>
                                </c:if>
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">融资方式</label>
                        <div class="layui-input-inline">
                            <select name="financingType">
                                <option value="">全部</option>
                                <option value="1">债权融资</option>
                                <option value="1">股权融资</option>
                                <option value="1">其他</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <button class="layui-btn layuiadmin-btn-admin" lay-submit lay-filter="lay-lx-search">
                            <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>查询
                        </button>
                        <button class="layui-btn layuiadmin-btn-admin" lay-submit lay-filter="lay-lx-back-reset">
                            <i class="layui-icon layui-icon-fonts-clear  layuiadmin-button-btn"></i>重置
                        </button>
                        <button class="layui-btn layuiadmin-btn-admin" lay-submit lay-filter="lay-rzlx-new">
                            <i class="layui-icon layui-icon-add-1  layuiadmin-button-btn"></i>新建
                        </button>
                    </div>
                </div>
            </div>
            <!-- 数据表单 -->
            <div class="layui-tab-item layui-show">
                <table id="lay-lx-create-manage" lay-filter="lay-lx-create-manage"></table>
            </div>
        </div>
    </div>
</div>

<script>
    layui.config({
        base: '${ctx}/resources/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'table', 'set', 'transfer', 'laydate', 'element', 'layer'], function () {
        var $ = layui.$
            , form = layui.form
            , table = layui.table
            , element = layui.element
            , laydate = layui.laydate
            , layer = layui.layer;

        loadrzlx();

        //选项卡切换监听
        element.on('tab(rzlx-tab-all)', function (data) {
            var layId = $(this).attr('lay-id');
            if (layId === "0") {
                loadrzlx();
            } else if (layId === "1") {
                loadrzcd();
            } else if (layId === "2") {
                loadrzjd();
            } else if (layId === "3") {
                loadLx();
            }
        });

        //营销立项页面
        /**************************************** 融资立项页面 **************************************************************/
        function loadrzlx() {
            //日期
            laydate.render({
                elem: '#rzlx-laydate-date'
            });

            // 表单
            table.render({
                elem: '#lay-rzlx-create-manage'
                , url: basePath + '/lookInfoBegin/queryFinancingByCondition' //请求数据接口
                , cols: [[
                    {field: 'compName', title: '区域公司', align: 'center'}
                    , {field: 'proName', title: '项目名称', align: 'center',templet:function (d) {
                            if (d.beginName!='' && d.beginName!=null){
                                return d.beginName;
                            }else{
                                return d.proName;
                            }
                        }}
                    , {
                        field: 'beginStatus', title: '融资初调', align: 'center', event: '0', templet: function (d) {
                            var optStr = "";
                            //1=审批中 9=审批完成 10=审批终止
                            if (d.beginStatus == 1) {
                                optStr += '<span style="font-size: 25px;color: rgb(225,93,36)">ニ</span>';
                            } else if (d.beginStatus == 9) {
                                optStr += '<span style="font-size: 25px;color: rgb(59,177,156)">✓</span>';
                            } else if (d.beginStatus == 10) {
                                optStr += '<span style="font-size: 25px;color: rgb(225,6,6)">ㄨ</span>';
                            }
                            return optStr;
                        }
                    }
                    , {
                        field: 'infoStatus', title: '融资尽调', align: 'center', event: '1', templet: function (d) {
                            var optStr = "";
                            //1=审批中 9=审批完成 10=审批终止
                            if (d.infoStatus == 1) {
                                optStr += '<span style="font-size: 25px;color: rgb(225,93,36)">ニ</span>';
                            } else if (d.infoStatus == 9) {
                                optStr += '<span style="font-size: 25px;color: rgb(59,177,156)">✓</span>';
                            } else if (d.infoStatus == 10) {
                                optStr += '<span style="font-size: 25px;color: rgb(225,6,6)">ㄨ</span>';
                            }else if (d.infoId) {
                                optStr += ' <span style="font-size: 35px;color: rgb(22,168,225);margin-top: -5px">○</span>';
                            }
                            return optStr;
                        }
                    }
                    , {
                        field: 'setupStatus', title: '立项', align: 'center', event: '2', templet: function (d) {
                            var optStr = "";
                            //1=审批中 9=审批完成 10=审批终止
                            if (d.setupStatus == 1) {
                                optStr += '<span style="font-size: 25px;color: rgb(225,93,36)">ニ</span>';
                            } else if (d.setupStatus == 9) {
                                optStr += '<span style="font-size: 25px;color: rgb(59,177,156)">✓</span>';
                            } else if (d.setupStatus == 10) {
                                optStr += '<span style="font-size: 25px;color: rgb(225,6,6)">ㄨ</span>';
                            }else if (d.setupId) {
                                optStr += ' <span style="font-size: 35px;color: rgb(22,168,225);margin-top: -5px">○</span>';
                            }
                            return optStr;
                        }
                    }
                ]]
                , page: true
                , limit: 10
            });

            //监听搜索
            form.on('submit(lay-rzlx-search)', function (data) {
                table.reload('lay-rzlx-create-manage', {
                    page: {curr: 1},
                    where: trimData(data)
                });
            });
            //重置清空
            form.on('submit(lay-rzlx-back-reset)', function (data) {
                reset_form('rzlx-query-form');
                //额外处理select
                $("#query-form-state").val('');
                form.render();
            });

            // 监听操作列
            table.on('tool(lay-rzlx-create-manage)', function (obj) {
                var data = obj.data;
                if (obj.event === 'view') {//查看详情
                    parent.layui.index.openTabsPage(basePath + '/proTrack/toDealOrDetail?proCode=' + data.proCode, '项目跟踪 > 详情');
                } else if (obj.event === 'copy') {//复制单据
                    parent.layui.index.openTabsPage(basePath + '/collectProject/toCopy?id=' + data.id, '项目信息收集 > 复制单据');
                } else if (obj.event === 'del') {
                    layer.confirm('确定要删除？', {icon: 3, title: '提示'}, function (index) {
                        $.ajax({
                            type: 'post',
                            url: basePath + '/flowProcess/logicDel',
                            data: {
                                "processId": data.processId
                            },//数据，这里使用的是Json格式进行传输
                            success: function (result) {
                                if (result) {
                                    table.reload('lay-rzlx-create-manage'); //数据刷新
                                    layer.close(index); //关闭弹层
                                } else {
                                    layer.msg('数据通信异常~', {icon: 0});
                                }
                            }
                        });
                    })
                } else if (obj.event === '0') {
                    parent.layui.index.openTabsPage(basePath + '/collectProject/toDealOrDetail?id=' + data.id + '&proCode=' + data.proCode, '项目信息收集 > 详情');
                } else if (obj.event === '1') {
                    if (data.prepareProType) {
                        parent.layui.index.openTabsPage(basePath + '/preProject/toDealOrDetail?id=' + data.prepareProId + '&proCode=' + data.proCode, '预立项 > 详情');
                    }
                } else if (obj.event === '2') {
                    if (data.projectType) {
                        parent.layui.index.openTabsPage(basePath + '/setupPro/toDealOrDetail?id=' + data.projectId + '&proCode=' + data.proCode, '立项 > 详情');
                    }
                } else if (obj.event === '3') {
                    if (data.marketingType) {
                        parent.layui.index.openTabsPage(basePath + '/proSell/toDealOrDetail?proCode=' + data.proCode + '&id=' + data.marketingId, '营销策划 > 详情');

                    }
                }
            });
        }

        //项目信息收集
        /******************************************** 融资初调 *********************************************************/
        function loadrzcd() {
            //日期
            laydate.render({
                elem: '#rzcd-laydate-dates'
                , range: '~'
            });
            // 表单
            table.render({
                elem: '#lay-rzcd-create-manage'
                , url: basePath + '/lookInfoBegin/queryDataByCondition' //请求数据接口
                , cols: [[
                    {type: 'checkbox', fixed: 'left'}
                    , {field: 'proCode', title: '项目编码', width: 145}
                    , {field: 'proName', title: '项目名称'}
                    , {field: 'compName', title: '区域公司', align: 'center'}
                    , {
                        field: 'addTime', title: '创建时间', width: 160, templet: function (d) {
                            return layui.util.toDateString(d.addTime, "yyyy-MM-dd");
                        }
                    }
                    , {field: 'staffName', title: '申请人', width: 100}
                    , {
                      field: 'isCredit', title: '授信余额', width: 150,templet:function (d) {
                           var credit = '';
                            if (d.isCredit == '0') {
                                credit = '满足'
                            } else if (d.isCredit == '1') {
                                credit = '不满足'
                            }
                            return credit;
                        }}
                    ,{
                        field: 'processStatus', title: '单据状态', width: 150, templet: function (d) {
                            var status = '';
                            if (d.processStatus == '1') {
                                status = '审批中'
                            } else if (d.processStatus == '9') {
                                status = '审批完成'
                            } else if (d.processStatus == '10') {
                                status = '审批终止'
                            }
                            return status
                        }
                    }
                    , {
                        title: '操作', width: 140, align: 'center', fixed: 'right', templet: function (d) {
                            var optStr = "";
                            optStr += '<a class="layui-btn layui-btn-xs" lay-event="view"><i class="layui-icon layui-icon-form"></i>详情</a>';
                            return optStr;
                        }
                    }
                ]]
                , page: true
                , limit: 10
            });
            //监听搜索
            form.on('submit(lay-rzcd-search)', function (data) {
                table.reload('lay-rzcd-create-manage', {
                    page: {curr: 1},
                    where: trimData(data)
                });
            });
            //重置清空
            form.on('submit(lay-rzcd-back-reset)', function (data) {
                reset_form('rzcd-query-form');
                //额外处理select
                $("#query-form-state").val('');
                form.render();
            });


            // 监听操作列
            table.on('tool(lay-rzcd-create-manage)', function (obj) {
                var data = obj.data;
                if (obj.event === 'view') {//查看详情
                    parent.layui.index.openTabsPage(basePath + '/lookInfoBegin/toDealOrDetail?id=' + data.id + '&proCode=' + data.proCode, '融资初调 > 详情');
                } else if (obj.event === 'copy') {//复制单据
                    parent.layui.index.openTabsPage(basePath + '/collectProject/toCopy?id=' + data.id, '项目信息收集 > 复制单据');
                } else if (obj.event === 'del') {
                    layer.confirm('确定要删除？', {icon: 3, title: '提示'}, function (index) {
                        $.ajax({
                            type: 'post',
                            url: basePath + '/flowProcess/logicDel',
                            data: {
                                "processId": data.processId
                            },//数据，这里使用的是Json格式进行传输
                            success: function (result) {
                                if (result) {
                                    table.reload('lay-rzcd-create-manage'); //数据刷新
                                    layer.close(index); //关闭弹层
                                } else {
                                    layer.msg('数据通信异常~', {icon: 0});
                                }
                            }
                        });
                    })
                }
            });
        }

        //预立项
        /*************************************************** 融资尽调 **********************************************************/
        function loadrzjd() {
            //日期
            laydate.render({
                elem: '#rzjd-laydate-dates'
                , range: '~'
            });

            // 表单
            table.render({
                elem: '#lay-rzjd-create-manage'
                ,
                url: basePath + '/lookInfo/queryDataByCondition' //请求数据接口
                ,
                cols: [[
                    {type: 'checkbox', fixed: 'left'}
                    , {field: 'proCode', title: '项目编码', width: 145}
                    , {field: 'proName', title: '项目名称'}
                    , {field: 'compName', title: '区域公司', align: 'center'}
                    , {
                        field: 'addTime', title: '创建时间', width: 160, templet: function (d) {
                            return layui.util.toDateString(d.addTime, "yyyy-MM-dd");
                        }
                    }
                    , {field: 'staffName', title: '申请人', width: 100}
                    , {
                        field: 'isCredit', title: '授信余额', width: 150,templet:function (d) {
                            var credit = '';
                            if (d.isCredit == '0') {
                                credit = '满足'
                            } else if (d.isCredit == '1') {
                                credit = '不满足'
                            }
                            return credit;
                        }}
                    ,{
                        field: 'processStatus', title: '单据状态', width: 150, templet: function (d) {
                            var status = '';
                            if (d.processStatus == '1') {
                                status = '审批中'
                            } else if (d.processStatus == '9') {
                                status = '审批完成'
                            } else if (d.processStatus == '10') {
                                status = '审批终止'
                            }
                            return status
                        }
                    }
                    , {
                        title: '操作', width: 140, align: 'center', fixed: 'right', templet: function (d) {
                            var optStr = "";
                            optStr += '<a class="layui-btn layui-btn-xs" lay-event="view"><i class="layui-icon layui-icon-form"></i>详情</a>';
                            return optStr;
                        }
                    }
                ]]
                ,
                page: true
                ,
                limit: 10
            });

            //监听搜索
            form.on('submit(lay-rzjd-search)', function (data) {
                table.reload('lay-rzjd-create-manage', {
                    page: {curr: 1},
                    where: trimData(data)
                });
            });
            //重置清空
            form.on('submit(lay-rzjd-back-reset)', function (data) {
                reset_form('rzjd-query-form');
                //额外处理select
                $("#query-form-state").val('');
                form.render();
            });

            // 监听操作列
            table.on('tool(lay-rzjd-create-manage)', function (obj) {
                var data = obj.data;
                if (obj.event === 'view') {//查看详情
                    parent.layui.index.openTabsPage(basePath + '/lookInfo/toDealOrDetail?id=' + data.id + '&proCode=' + data.proCode, '融资尽调 > 详情');
                } else if (obj.event === 'copy') {//复制单据
                    parent.layui.index.openTabsPage(basePath + '/collectProject/toCopy?id=' + data.id, '项目信息收集 > 复制单据');
                } else if (obj.event === 'del') {
                    layer.confirm('确定要删除？', {icon: 3, title: '提示'}, function (index) {
                        $.ajax({
                            type: 'post',
                            url: basePath + '/flowProcess/logicDel',
                            data: {
                                "processId": data.processId
                            },//数据，这里使用的是Json格式进行传输
                            success: function (result) {
                                if (result) {
                                    table.reload('lay-rzjd-create-manage'); //数据刷新
                                    layer.close(index); //关闭弹层
                                } else {
                                    layer.msg('数据通信异常~', {icon: 0});
                                }
                            }
                        });
                    })
                }
            });
        }

        //立项
        /*************************************************** 立项 **********************************************************/
        function loadLx() {
            //日期
            laydate.render({
                elem: '#lx-laydate-dates'
                , range: '~'
            });

            // 表单
            table.render({
                elem: '#lay-lx-create-manage'
                , url: basePath + '/setupFin/queryDataByCondition' //请求数据接口
                , cols: [[
                    {type: 'checkbox', fixed: 'left'}
                    , {field: 'proCode', title: '项目编码', width: 145}
                    , {field: 'proName', title: '项目名称'}
                    , {field: 'compName', title: '区域公司', align: 'center'}
                    , {
                        field: 'addTime', title: '创建时间', width: 160, templet: function (d) {
                            return layui.util.toDateString(d.addTime, "yyyy-MM-dd");
                        }
                    }
                    , {field: 'staffName', title: '申请人', width: 100}
                    , {
                        field: 'financingType', title: '融资方式', width: 150,templet:function (d) {
                            var type = '';
                            if (d.financingType == '1') {
                                type = '债权融资'
                            } else if (d.financingType == '2') {
                                type = '股权融资'
                            }else if (d.financingType == '3') {
                                type = '其他'
                            }
                            return type;
                        }}
                    ,{
                        field: 'processStatus', title: '单据状态', width: 150, templet: function (d) {
                            var status = '';
                            if (d.processStatus == '1') {
                                status = '审批中'
                            } else if (d.processStatus == '9') {
                                status = '审批完成'
                            } else if (d.processStatus == '10') {
                                status = '审批终止'
                            }
                            return status
                        }
                    }
                    , {
                        title: '操作', width: 140, align: 'center', fixed: 'right', templet: function (d) {
                            var optStr = "";
                            optStr += '<a class="layui-btn layui-btn-xs" lay-event="view"><i class="layui-icon layui-icon-form"></i>详情</a>';
                            return optStr;
                        }
                    }
                ]]
                , page: true
                , limit: 10
            });

            //监听搜索
            form.on('submit(lay-lx-search)', function (data) {
                table.reload('lay-lx-create-manage', {
                    page: {curr: 1},
                    where: trimData(data)
                });
            });
            //监听新建
            form.on('submit(lay-rzlx-new)', function (data) {
                parent.layui.index.openTabsPage(basePath + '/setupFin/toDealOrDetail', '融资立项 > 新增');
            });
            //重置清空
            form.on('submit(lay-lx-back-reset)', function (data) {
                reset_form('lx-query-form');
                //额外处理select
                $("#query-form-state").val('');
                form.render();
            });

            // 监听操作列
            table.on('tool(lay-lx-create-manage)', function (obj) {
                var data = obj.data;
                if (obj.event === 'view') {//查看详情
                    parent.layui.index.openTabsPage(basePath + '/setupFin/toDealOrDetail?id=' + data.id + '&proCode=' + data.proCode, '立项 > 详情');
                }
            });
        }
    });
</script>
</body>
</html>

